<!--{template admin/header_tpl}-->

<div class="mainarea">
	<div class="maininner">
		<div class="tabs_header">
			<ul class="tabs">
				<li><a href="<!--{eval echo base_url()}-->admin/admin_activity/index"><span>浏览主页活动</span></a></li>
				<li class="null"><a href="<!--{eval echo base_url()}-->admin/admin_activity/add_activity">添加主页活动</a></li>
			</ul>
		</div>
<!--加载数据-->
		<form action="<!--{eval echo base_url()}-->admin/admin_activity/add_activity" method="post" accept-charset="utf-8" enctype="multipart/form-data">
			<div class="bdrcontent">
				<table class="formtable" cellspacing="5" cellpadding="5">
					<tr>
						<th style="width:12em;">品牌</th>
						<td>
							<select name="set[brandid]">
								<option value="0" >请选品牌</option>
								<!--{loop $brands $brand}-->
									
									<option value="{$brand['bid']}" <!--{if $thevalue[brandid] == $brand[bid]}--> selected <!--{/if}-->>{$brand[firstletter]}-{$brand['name']}</option>
								<!--{/loop}-->
							</select>
							<a href="#" onclick="$('#addbrand').dialog('open');">添加品牌</a>
						</td>
					</tr>
					<tr>
						<th>分类</th>
						<td>
							<select name="set[catid]">
								<option value="0" >请选择分类</option>
								<!--{loop $category $cat}-->
									
									<option value="{$cat[catid]}" >{$cat[name]}</option>
								<!--{/loop}-->
							</select>
						</td>
					</tr>
					<tr>
						<th>活动标题</th>
						<td><input type="text" name="set[title]" value="$thevalue[title]" size="30"></td>
					</tr>
					<!--url img-->
					<tr id="url_action">
						<th>图片链接</th>
						<td><input type="text" name="set[imageurl]" value="" size="80"></td>
					</tr>
					<tr id="upload_action" style="display:none;">
						<th>上传图片</th>
						<td><input type="file" name="userfile" value="" id="image" size="20"></td>
					</tr>
					<tr>
						<th>图片操作</th>
						<td>外链图片<input type="radio" name="set[img_mode]" value="0" onclick="swich_img_mode();" <!--{if $thevalue[img_mode] !=1}--> checked <!--{/if}-->>
							上传图片<input type="radio" name="set[img_mode]" value="1" onclick="swich_img_mode();" <!--{if $thevalue[img_mode] ==1}--> checked <!--{/if}-->>
						</td>
					</tr>
					<tr>
						<th>链接地址</th>
						<td><input type="text" name="set[url]" value="$thevalue[url]" size="80"></td>
					</tr>
					<tr>
						<th>来源</th>
						<td>
							<select name="set[fromid]">
								<!--{loop $fromsource $from}-->
									<option value="{$from['fromid']}" >{$from['name']}</option>
								<!--{/loop}-->
							</select>
						</td>
					</tr>
					<tr>
						<th>折扣</th>
						<td><input type="text" name="set[discount]" value="$thevalue[discount]" size="10">折</td>
					</tr>
					<tr>
						<th>优先顺序</th>
						<td><input type="text" name="set[displayorder]" value="0" size="10">数字越大，排序越靠前，优先级越高</td>
					</tr>
					<tr>
						<th>开始时间</th>
						<td><input type="text" id="starttime" name="set[stime]" value="$thevalue[starttime]" size="10"></td>
					</tr>
					<tr>
						<th>结束时间</th>
						<td><input type="text" id="endtime" name="set[etime]" value="$thevalue[endtime]" size="10"></td>
					</tr>
				</table>
			</div>
		<div class="footactions">
		<input type="submit" name="thevaluesubmit" value="提交" class="submit">
		</div>
		</form>
	</div>
</div>
<div class="side">
	<!--{template admin/side}-->
</div>
<!--添加品牌-->
<div id="addbrand" title="添加品牌">
	<!--{template admin/add_brand_ajax_tpl}-->
</div>
<script type="text/javascript" src="<!--{eval echo base_url()}-->resources/js/datepicker_cn.js"></script>
<script>
$(function() {
	$.datepicker.setDefaults($.extend({showMonthAfterYear: false}, $.datepicker.regional['zh-CN']));
	$("#starttime").datepicker("option", "dateFormat", 'yy-mm-dd');
	$("#starttime").datepicker($.datepicker.regional['zh-CN']);
	$("#endtime").datepicker("option", "dateFormat", 'yy-mm-dd');
	$("#endtime").datepicker($.datepicker.regional['zh-CN']);
});
function swich_img_mode(){
	$('#url_action').toggle();
	$('#upload_action').toggle();
}
</script>

<!--{template admin/footer_tpl}-->